package day06.exercise1;

public class Worf extends Animal {
	private String name;
	private double weight;

	/**
	 * 在真正创建子类对象之前,会先去创建父类的对象
	 * @param name
	 * @param weight
	 */
	public Worf(String name, double weight) {
		//super()
		this.name = name;
		this.weight = weight;
	}

	//省略了@Override
	public String getDesc() {
		return "Worf:" + name + ",weight:" + weight;
	}

	public static void main(String[] args) {
		//输出对象 - 输出对象调用toString的方法
		//System.out.println(new Worf("狼", 10).toString());
		//观察自己当中是否提供了toString方法,自己里面没有提供,那么调用父类中的
		//父类中返回的是desc - 看程序的执行过程中是如何处理desc

		//Worf:null,weight:0.0
		System.out.println(new Worf("狼", 10));
	}
}
